#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QtCharts>
#include "sensor.h"
#include <QLayout>

#include <QLayout>
#include <QPushButton>
#include <QLabel>
#include <QTimer>
#include <QSlider>
#include "map.h"
#include "path.h"

#include "vehicle.h"

#include "controller.h"
#include <paplan.h>
#include <zmath.h>


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);

    ~MainWindow();
private slots:
    void ontime();
    void onclick1();
    void onclick2();
    void onclick3();
    void onclick4();
    void onclick5();
    void onclick6();
    void onclick7();
private:
    Sensor lidar;

    void PolarChartInit();
    void PolarChartUpdate(QVector<QPointF> sv);

//    bool SetPath(QString nFName);
private:

//    void getspdset();
    //QLineSeries *seriesWD;
    QScatterSeries *seriesWDP;
    QPolarChart *chartWD;
    QValueAxis *angleAxis;
    QValueAxis *radialAxis;
    QChartView *chartViewWD;

    QVector<QPointF> sensorp;

    QPushButton *btn1;
    QPushButton *btn2;
    QPushButton *btn3;
    QPushButton *btn4;
    QPushButton *btn5;
    QPushButton *btn6;
    QPushButton *btn7;
    QLabel *lbl;
    QLabel *lbl1;
    QTimer *timer;
    QSlider *slider;

    Map vmap;
    Vehicle *veh;
    Paplan *myplan;
    double spdlset=0,spdrset=0;
    QVector<double> veht,vehlspd,vehrspd;//车辆速度规划
    int timeid=0;
    bool vehstart=false;
    int time_step = 20;
    int clicknum = 0;

    Path vpath;
    double vspd=0,vang=0;

    controller vctrl;
    double followErr;
    double kp=0;
    double ki=0;
    double kd=0;
};
#endif // MAINWINDOW_H
